package com.kakarote.oa.common;

import com.kakarote.core.common.enums.SystemCodeEnum;
import com.kakarote.core.exception.CrmException;

/**
 * @author wwl
 * @date 2022/7/22 11:21
 */

/**
 * 审核状态枚举 0 待审核、1通过、2拒绝、3审核中 4:撤回 5 未提交 6 创建 7 已删除 8 作废 10 忽略 即未启用审批流 ,11 转发,12 征求他人意见,13终止 14委托
 */
public enum OaExamineStatusEnum {
    AWAIT(0, "待审核"),
    PASS(1, " "),
    REJECT(2, "拒绝"),
    UNDERWAY(3, "审核中"),
    RECHECK(4, "撤回"),
    UN_SUBMITTED(5, "未提交"),
    CREATE(6, "创建"),
    REMOVE(7, "已删除"),
    INVALID(8, "作废"),
    IGNORE(10, "忽略"),
    FORWARD(11, "转发"),
    SEEK(12, "征求他人意见"),
    END(13, "终止"),
    ARCHIVE(14, "归档"),
    COPY(15, "抄送"),
    DELEGATE(17, "委托"),
    ;

    OaExamineStatusEnum(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    private final Integer status;
    private final String msg;

    public Integer getStatus() {
        return status;
    }

    public String getMsg() {
        return msg;
    }

    public static OaExamineStatusEnum parse(Integer status) {
        for (OaExamineStatusEnum examineStatusEnum : values()) {
            if (examineStatusEnum.getStatus().equals(status)) {
                return examineStatusEnum;
            }
        }
        throw new CrmException(SystemCodeEnum.SYSTEM_NO_VALID);
    }
}
